home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / surfsrc3.zip / ONSCREEN.INC < prev    next >
Text File  |  1991-09-25  |  2KB  |  73 lines

  1. function ONSCREEN (Surf: word): boolean;
  2.  
  3. { Returns true if any part of surface #Surf is within screen limits }
  4.  
  5. var Vert: integer;                    { vertex # }
  6.     Node: word;                       { node # of vertex }
  7.     On: boolean;                      { result to be returned }
  8.  
  9. begin
  10. {$ifdef BIGMEM}
  11. with ptrd^ do with ptre^ do with ptrh^ do
  12. begin
  13. {$endif}
  14.  
  15.   if (Magnify <= 1.0) then
  16.     { If no magnification, then by definition all surfaces are on the
  17.       screen }
  18.     Onscreen := TRUE
  19.   else begin
  20.     Vert := 1;
  21.     On := FALSE;
  22.     while (Vert <= Nvert[Surf]) and (not On) do begin
  23.       Node := konnec (Surf, Vert);
  24.       if (Xtran[Node] >= Gxmin) then
  25.         On := TRUE;
  26.       Vert := Vert + 1;
  27.     end;
  28.     if (not On) then
  29.       Onscreen := FALSE
  30.     else begin
  31.       Vert := 1;
  32.       On := FALSE;
  33.       while (Vert <= Nvert[Surf]) and (not On) do begin
  34.         Node := konnec (Surf, Vert);
  35.         if (Xtran[Node] <= Gxmax) then
  36.           On := TRUE;
  37.         Vert := Vert + 1;
  38.       end;
  39.       if (not On) then
  40.         Onscreen := FALSE
  41.       else begin
  42.         Vert := 1;
  43.         On := FALSE;
  44.         while (Vert <= Nvert[Surf]) and (not On) do begin
  45.           Node := konnec (Surf, Vert);
  46.           if (Ytran[Node] >= Gymin) then
  47.             On := TRUE;
  48.           Vert := Vert + 1;
  49.         end;
  50.         if (not On) then
  51.           Onscreen := FALSE
  52.         else begin
  53.           Vert := 1;
  54.           On := FALSE;
  55.           while (Vert <= Nvert[Surf]) and (not On) do begin
  56.             Node := konnec (Surf, Vert);
  57.             if (Ytran[Node] <= Gymax) then
  58.               On := TRUE;
  59.             Vert := Vert + 1;
  60.           end;
  61.           if (not On) then
  62.             Onscreen := FALSE
  63.           else
  64.             Onscreen := TRUE;
  65.         end; { Gymax }
  66.       end; { Gymin }
  67.     end; { Gxmax }
  68.   end; { Gxmin }
  69. {$ifdef BIGMEM}
  70. end; {with}
  71. {$endif}
  72. end; { procedure ONSCREEN }
  73.